import { defineStore } from 'pinia';

export const useSystemStore = defineStore('system', {
  state: () => {
    return {
      systemIcon: localStorage.getItem('system-icon') || '@/assets/img/logo1.png',
      systemName: localStorage.getItem('systemName') || '视听整合连续性训练系统',
      unit_name: localStorage.getItem('unit_name') || ''
    };
  },
  getters: {},
  actions: {
    setSystemName(name: string) {
      this.systemName = name;
      localStorage.setItem('systemName', name);
    },
    setSystemIcon(icon: any) {
      this.systemIcon = icon;
      localStorage.setItem('systemIcon', JSON.stringify(icon));
    },
    setUnit_name(name: string) {
      this.unit_name = name;
      localStorage.setItem('unit_name', name);
    },
  }
});
